package com.maweirdos.ai.config;

import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 聊天顾问配置类
 * 配置使用数据库持久化的聊天记忆顾问
 */
@Configuration
public class ChatAdvisorConfig {

    /**
     * 配置消息聊天记忆顾问
     * 该顾问会自动将聊天历史添加到请求中
     */
    @Bean
    public MessageChatMemoryAdvisor messageChatMemoryAdvisor(ChatMemory chatMemory) {
        return MessageChatMemoryAdvisor.builder(chatMemory).build();
    }
} 